<template>
  <div>
    <!--  顶部栏  -->
    <div class="header">
      <div class="right">
        <!-- <img class="avatar" src="../assets/avater.png">
        <div class="name">
          {{adminName}}
        </div> -->
        <img class="exist" src="@/assets/exist.png" @click="exit()">
      </div>
    </div>

    <!--  侧边栏  -->
    <div class="left-tab">
      <div class="tab-header">
        <img src="@/assets/logo.png">
        <h1>系统管理</h1>
      </div>
      <div class="tab-list">
        <el-menu
          :default-active="index"
          class="el-menu-vertical-demo"
          @select="selectMenu"
          @open="handleOpen"
          @close="handleClose">
          <!-- <el-submenu index="1">
            <template slot="title">
              <span>经济责任审计</span>
            </template>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">
              <span>财政收支审计</span>
            </template>
            <el-menu-item index="2-1">
              <template slot="title">同级审</template>
            </el-menu-item>
            <el-menu-item index="2-2">
              <template slot="title">部门预算执行</template>
            </el-menu-item>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">
              <span>自然资源资产</span>
            </template>
          </el-submenu> -->
          <el-menu-item index="1">
            <span slot="title">项目管理</span>
          </el-menu-item>
          <el-menu-item index="2">
            <span slot="title">菜单管理</span>
          </el-menu-item>
          <el-menu-item index="3">
            <span slot="title">API接口管理</span>
          </el-menu-item>
          <!-- <el-menu-item index="4">
            <span slot="title">用户管理</span>
          </el-menu-item> -->
        </el-menu>
      </div>
    </div>

    <!--  主体内容  -->
    <div class="main">
      <div class="block" ><!--  占位块勿删    --></div>
      <!--   内容框架   -->
      <div class="main-content">
        <div v-if="index==1">
          <program />
          </div>
          <div v-if="index==2">
            <tmenu />
          </div>
          <div v-if="index==3">
            <api />
          </div>
          <div v-if="index==4">
            <user />
          </div>
      </div>
    </div>
  </div>
</template>

<script>
import api from './component/api.vue'
import tmenu from './component/tmenu.vue'
import program from './component/program.vue'
import user from './component/user.vue'
export default {
  components: { api,tmenu,program,user },
  name: 'setting',  
  data(){
    return{
      index:'1'
    }
  },
  computed: {
    // adminName(){
    //   return JSON.parse(localStorage.getItem('userInfo')).name;
    // },
    // adminType(){
    //   let user = JSON.parse(localStorage.getItem('userInfo')).name;
    //   return user === '测试账号1'?'测试账号':'普通用户'
    // },
  },
  methods:{
    selectMenu(index,path){
      this.index=index;
    },
    exit(){
      this.$router.push({ path: '/dashboard' })
    },
  },
  mounted() {
  }
}
</script>
<style scoped lang="less" >
  /* 顶部栏*/
  .header{
    z-index: 999;
    width: 100%;
    position: fixed;
    top: 0;
    display: flex;
    justify-content: flex-end;
    height: 64px;
    background-color: #fff;
    padding: 0 30px;
    border-bottom: solid 1px rgba(231, 231, 231, 1);
    .right{
      display: flex;
      height: 64px;
      align-items: center;
      .avatar{
        height: 35px;
        width: 35px;
      }
      .name{
        font-size: 16px;
        color: rgba(0, 0, 0, 1);
        margin-left: 10px;
      }
      .adminType{
        border-radius: 2px;
        background-color: rgba(0, 82, 217, 0.08);
        font-size: 14px;
        color: rgba(0, 82, 217, 1);
        padding: 4px 6px;
        margin-left: 10px;
      }
      .exist{
        height: 35px;
        width: 35px;
        padding: 8px;
        cursor: pointer;
        margin-left: 30px;
      }
    }
  }

  /*侧边栏*/
  .left-tab{
    position: fixed;
    top: 0;
    width: 138px;
    left: 0;
    z-index: 999;
    height: 100vh;
    background-color: #fff;
    .tab-header{
      width: 240px;
      height: 64px;
      display: flex;
      align-items: center;
      padding-left: 20px;
      border-bottom: solid 1px rgba(231, 231, 231, 1);
      img{
        height: 35px;
        width: 35px;
      }
      h1{
        font-size: 18px;
        margin-left: 10px;
      }
    }
    .tab-list{
      margin: 15px 10px;
      .tab-item{
        display: flex;
        height: 45px;
        justify-content: center;
        align-items: center;
        //background-color: #2468F2;
        border-radius: 5px;
        margin-bottom: 10px;
        transition: all .2s;
        i{
          font-size: 25px;
          color: rgba(233, 232, 237, 1);
        }
        .title{
          font-size: 14px;
          color: rgba(0, 0, 0, 0.6);
          margin-left: 12px;
        }
        &:hover{
          background-color: rgba(83, 86, 90, 0.05);
        }
      }
      .active{
        background-color: rgba(83, 86, 90, 0.05);
        i{
          color: rgba(57, 145, 238, 1);
        }
        .title{
          color: rgba(57, 145, 238, 1);
        }
      }
    }

  }

  /*主体*/
  .main{
    display: flex;
    width: 100%;
    //padding-top: 64px;
    .block{
      width: 138px;
      height: 100vh;
    }
    .main-content{
      overflow: hidden;
      flex: 1;
      margin: 72px 15px 15px 15px;
      background-color: #fff;
    }
  }
  /deep/ .el-submenu .el-menu-item{
    min-width: 100px;
  }
  /deep/.el-menu{
    border-right: 0;
  }
</style>
<style  lang="less">
  .content{
    display:flex;
    .left-box{
      flex:0 0 200px;
      margin-right:30px;
    }
    .right-box{
      flex:1;
      border-left:1px solid #f2f3f5;
      padding-left :20px;
    }
  }
</style>

